package cn.xanderye.mdblog.service;

import cn.xanderye.mdblog.base.BaseService;
import cn.xanderye.mdblog.entity.User;
import cn.xanderye.mdblog.vo.UserVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 *
 * @author Xander
 * @date 2018-11-20
 */
@FeignClient(name = "mdblog-service", path = "user")
public interface UserService extends BaseService<User> {
    /**
     * 登录
     * @param user
     * @return
     */
    @PostMapping("login")
    UserVO login(@RequestBody User user);
    /**
     * 注册
     * @param user
     * @return
     */
    @PostMapping("register")
    void register(@RequestBody User user, @RequestParam String code, @RequestParam String verCode, @RequestParam String uploadRoot, @RequestParam String avatarPath);

    /**
     * 根据permission获取博客拥有者
     * @param permission
     * @return
     */
    @GetMapping("findUserByPermission")
    User findUserByPermission(@RequestParam Integer permission);

    /**
     * 根据token查询用户
     * @param token
     * @return cn.xanderye.mdblog.entity.User
     * @author yezhendong
     * @date 2019-07-10
     */
    @GetMapping("findByToken")
    User findByToken(@RequestParam String token);

    /**
     * 根据用户名查找
     * @param username
     * @return cn.xanderye.mdblog.entity.User
     * @author yezhendong
     * @date 2019/9/12
     */
    @GetMapping("findUserByUsername")
    User findUserByUsername(@RequestParam String username);
}
